package com.nebula.common.datasource.mongo.db;

import com.mongodb.MongoClient;
import com.mongodb.client.MongoCollection;
import com.nebula.common.datasource.mongo.annotation.CollName;
import org.bson.Document;

public class MongoDB {
	
	private String dbName;
	
	public MongoDB(String dbName){
		this.dbName=dbName;
	}
	
	/**
	 * 获得普通collection
	 * @param colName
	 * @return
	 */
	public MongoCollection<Document> collection(String colName){
		MongoCollection<Document> mc=null;//MongoClient.open(this.dbName).getCollection(colName);
		return mc;
	}
	
	/**
	 * 获得cls 的 Monog集合（cls 需要有 collName注解）
	 * @return
	 */
	public <T> MongoCollection<Document> getCollection(Class<T> cls) {
		CollName collName = cls.getAnnotation(CollName.class);
		return null;//MongoClient.open(this.dbName).getCollection(collName.value());
	}
}
